package com.darwin.darwinMVC.core
{
	import com.darwin.darwinMVC.mvc.ModelData;
	
	import flash.utils.Dictionary;

	/**
	 * 公共数据
	 * @author lipi
	 */
	public class CommonData
	{
		public function CommonData()
		{
			_modelDataDic = new Dictionary();
			_generalDataDic = new Dictionary();
		}
		
		
		private var _modelDataDic:Dictionary;
		private var _generalDataDic:Dictionary;
		
		/**
		 *注册modeldata信息 
		 * @param data
		 * @param name
		 * 
		 */
		public function registerData(data:ModelData, name:String):void
		{
			_modelDataDic[name] = data;
		}
		
		public function getDataByName(name:String):ModelData
		{
			return _modelDataDic[name];
		}
		
		/**
		 *注册一般数据信息 
		 * @param data
		 * @param name
		 * 
		 */
		public function registerGeneralData(data:*, name:String):void
		{
			_generalDataDic[name] = data;
		}
		
		/**
		 *获取一般的数据信息 
		 * @param name
		 * @return 
		 * 
		 */
		public function getGeneralDataByName(name:String):*
		{
			return _generalDataDic[name];
		}
		
		/**
		 *删除一般数据信息 
		 * @param name
		 * 
		 */
		public function deleteGeneralDataByName(name:String):void
		{
			 delete _generalDataDic[name];
		}
	}
}